{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import sys\n",
    "sys.path.insert(0,'/home/csunix/schtmt/NewFolder/caffe_Sep/python')\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import caffe\n",
    "#% matplotlib inline#THIS LINE HAS ERROR -> USE THE FOLLOWING 2 LINES\n",
    "# from IPython import get_ipython\n",
    "# get_ipython().run_line_magic('matplotlib', 'inline')\n",
    "\n",
    "caffe.set_device(0)\n",
    "caffe.set_mode_gpu()\n",
    "solver = caffe.SGDSolver('solver_patch.prototxt')\n",
    "niter = 60000\n",
    "train_loss = np.zeros(niter)\n",
    "\n",
    "for i in range(niter):\n",
    "    solver.step(1)\n",
    "    #print solver.net.blobs.keys()\n",
    "    #     train_loss[i] = solver.net.blobs['l2_error'].data\n",
    "    loss = solver.net.blobs['cross_entropy_loss'].data\n",
    "    if (i%100 == 0):\n",
    "        print('iteration', i, ':cross-entropy-loss', loss) \n",
    "    train_loss[i] = loss\n",
    "    np.save('conv_lstm_AE_train_loss_22Sep',train_loss)\n",
    "    \n",
    " \n",
    "\n",
    "        \n",
    "    "
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
